package com.shengwei.truck.driver.vm;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.shengwei.truck.driver.bean.JsonStatisticsOneDayData;
import com.shengwei.truck.driver.bean.Result;
import com.shengwei.truck.driver.model.DataSource;
import com.shengwei.truck.driver.model.Repository;

/**
 *统计基类，共用函数
 */
public class BaseHistoryViewModel extends ViewModel {
    protected final Repository mRepository;
    private MutableLiveData<Result<JsonStatisticsOneDayData>> mStatisticOneDay = new MutableLiveData<>();

    /**
     * 构造函数
     */
    public BaseHistoryViewModel() {
        mRepository = Repository.getInstance(DataSource.getSingleInstance());
    }

    public MutableLiveData<Result<JsonStatisticsOneDayData>> getStatisticData() {
        return mStatisticOneDay;
    }

    /**
     * 获取某一天的统计数据
     */
    public void getStatisticOneDay(String date){
        mRepository.getStatisticOneDay(date,mStatisticOneDay);
    }

}
